package cn.sjxy.regi;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import sun.misc.Unsafe;

import java.lang.reflect.Field;

/**
 * ClassName:ReGi
 * Package:cn.sjxy.regi
 * Description:
 *
 * @Date:2022/5/23 18:04
 * @Author:SXW
 */
@Slf4j
@SpringBootApplication
@ServletComponentScan
@EnableTransactionManagement // 开启事务控制支持
public class ReGi {

    public static void main(String[] args) {
        disableWarning();
        SpringApplication.run(ReGi.class, args);
        log.info("系统启动！");
    }

    public static void disableWarning() {
        try {
            Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
            theUnsafe.setAccessible(true);
            Unsafe u = (Unsafe) theUnsafe.get(null);

            Class cls = Class.forName("jdk.internal.module.IllegalAccessLogger");
            Field logger = cls.getDeclaredField("logger");
            u.putObjectVolatile(cls, u.staticFieldOffset(logger), null);
        } catch (Exception e) {
            // ignore
        }
    }
}
